package com.mail.dubbo.mapper;

import com.mail.model.db.SmsFlashPromotionProductRelation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 商品限时购与商品关系表 Mapper 接口
 * </p>
 *
 * @author WJZ
 * @since 2022-06-20
 */
public interface SmsFlashPromotionProductRelationMapper extends BaseMapper<SmsFlashPromotionProductRelation> {
    @Delete("delete from mall.sms_flash_promotion_product_relation where flash_promotion_id=#{id};")
    void deleteByFlashPromotionId(@Param("id") Long id);

	@Select("select count(*) from mall.sms_flash_promotion_product_relation where flash_promotion_id=#{flashPromotionId} and flash_promotion_session_id=#{id}")
	Integer getProductCount(Long flashPromotionId, Long id);
}
